<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body bgcolor="#faebd7">
<div id="app">
    <span>{{ num }}</span>
    <h1>{{msg}}</h1>
    <button v-on:click="add">点我++</button>
    <button v-on:click="decrement">点我变</button>
</div>

<script src="node_modules/vue/dist/vue.js"></script>
<script>
    var app = new Vue({
        el: "#app",
        data: {
            num: 0,
            msg: "hello,vue"
        },
        methods: {
            add() {
                this.num++;
                this.msg = app.num;
                console.log(this)
                console.log(app)
            },
            // decrement:function () {
            //     this.msg = "hello,vue";
            // }
            decrement() {
                this.msg = "hello,vue";
            }
        },
        created() {
            this.num = 1000;
        },
        mounted() {
            this.num = 5000;
        }
    })
</script>

</body>
</html>